<?php 
if(!isset($_SESSION)) 
{ 
session_start(); 
} 
include 'checkdate.php';

if (isset($_SESSION['currentcarnum']) and is_array($_SESSION['currentcarnum'])) {
	include '../connection/connection.php';
	$currentcarnum = $_SESSION['currentcarnum'];
	$carnumber = $_REQUEST['carnumber'];
	$co=1;
	if($carnumber == "")
		$co=0;
	$car_datetime = $currentcarnum[2];
	$id = $currentcarnum[0];
	
	$sql="update carnum set carnumber='$carnumber',isReg='$co' where car_datetime= '$car_datetime' and id= '$id'";
	$res = mysql_query($sql,$connection);
	if($res==1){
		$currentcarnum[3] = $carnumber;
		$currentcarnum[6] = $co;
		$index = $currentcarnum[7];
		$mylistcarnum = $_SESSION['mylistcarnum'];
		$_SESSION['currentcarnum'] = array($currentcarnum[0],$currentcarnum[1],$currentcarnum[2],$currentcarnum[3],$currentcarnum[4],$currentcarnum[5],$currentcarnum[6],$currentcarnum[7]);
		$mylistcarnum[$index] = $_SESSION['currentcarnum'];
		$_SESSION['mylistcarnum']= $mylistcarnum;
	?>
		<div>
			<input id="index" type="text" value="<?=$index?>"/>
			<div id="click">SelectCar(this,'<?=$carnumber?>',event)</div>
			<div id="carnum"><?=$carnumber?></div>
			<div id="reg"><?=$co?></div>
		</div>
	<?php 
	}
	 
	//unset($_SESSION['currentcarnum']);
	mysql_close($connection);
	  
}
?>

